<?php if($users->UserPermission('forum_modtools', $core->EscapeString($username))){ ?>

<style type="text/css">
.formPiece {
	width: 430px;
}
</style>

<div id="grand_container" style="display: none;left: 10px; top:100px; position:fixed; width: 100%; height: 100%;z-index: 0;">
    <div style="width: 805px; margin: auto;">
		<div id="grand_top" style="cursor: default;">
			<a onClick="sluitDiv('grand_container')"><div id="grand_kruisje"></div></a>
		</div>

		<div id="grand_middle">
        
        	<div style="max-height:500px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">

				<style type="text/css">
				h1 {
					padding-right: 24px;
					border-bottom: 1px solid #eeeeee;
					color: #53637d;
					font-size: 18px;
					font-weight: normal;
					margin: 0;
					padding-bottom: 5px;
					text-shadow: white 0 1px 2px;
					margin-bottom: 20px;
				}
				
				a {
					cursor: pointer;
				}
				</style>

				<h1><?php echo $lang['mod_tools']; ?></h1>

    			<form method="post" action="functions/news_post_story.php">

    				<div class="formPiece" style="width: 97%">
    
						<h3 style="padding: 0; margin: 0;"><a onClick="openDiv('grand_container id_modify')"><?php echo $lang['edit_topic']; ?></a></h3>
    	
    				</div>
                    
                    <div class="formPiece" style="width: 97%">
    
						<h3 style="padding: 0; margin: 0;"><a onClick="openDiv('grand_container id_shielding')"><?php echo $lang['shield_topic']; ?></a></h3>
    	
    				</div>
                    
                    <div class="formPiece" style="width: 97%">
    
						<h3 style="padding: 0; margin: 0;"><a onClick="openDiv('grand_container id_close')"><?php echo $lang['close_topic']; ?></a></h3>
    	
    				</div>
                    
                    <div class="formPiece" style="width: 97%">
    
						<h3 style="padding: 0; margin: 0;"><a onClick="openDiv('grand_container id_delete')"><?php echo $lang['delete_topic']; ?></a></h3>
    	
    				</div>
    
				</form>
	
			</div>
		</div>
	<div id="grand_bottom"></div>
</div>   
</div>

<div id="grand_container id_modify" style="display: none;left: 10px; top:100px; position:fixed; width: 100%; height: 100%;">
    <div style="width: 805px; margin: auto;">
		<div id="grand_top" onMouseDown="dragStart(event, 'grand_container id_modify')">
			<a onClick="sluitDiv('grand_container id_modify')"><div id="grand_kruisje"></div></a>
		</div>

		<div id="grand_middle">
        
        	<div style="max-height:500px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">

				<style type="text/css">
				h1 {
					padding-right: 24px;
					border-bottom: 1px solid #eeeeee;
					color: #53637d;
					font-size: 18px;
					font-weight: normal;
					margin: 0;
					padding-bottom: 5px;
					text-shadow: white 0 1px 2px;
					margin-bottom: 20px;
				}
				</style>
                
                <?php 
				$qthread = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread'])."");
				$thread = mysql_fetch_array($qthread);
				?>

				<h1><?php echo $lang['edit_topic']; ?></h1>

    			<form method="post" action="actions/mod_tool_modify_thread.php">
                
                	<input type="hidden" name="id" value="<?php echo $core->EscapeString($_GET['thread']); ?>" />
                    <input type="hidden" name="forum" value="<?php echo $core->EscapeString($_GET['id']); ?>" />
                
                	<div class="formPiece" style="width: 97%">
                    
                    	<label><?php echo $lang['title']; ?></label>
                        <input type="text" name="name" style="width: 97%" value="<?php echo $thread['name']; ?>" />
                    
                    </div>
                    
                    <div class="formPiece" style="width: 97%">
                    
                    	<label><?php echo $lang['description']; ?></label>
                        <input type="text" name="description" style="width: 97%" value="<?php echo $thread['description']; ?>" />
                    
                    </div>
                    
                    <div class="formPiece" style="width: 97%">
                    
                    	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
                    
                    	<label><?php echo $lang['text']; ?></label>
                        <textarea id="ckeditor" name="text"><?php echo $thread['text']; ?></textarea>
                        
                        <script type="text/javascript">

							CKEDITOR.replace( 'ckeditor',
								{
									contentsCss : '../Public/Styles/Default/CSS/main.css',
									extraPlugins : 'stylesheetparser',
									enterMode : CKEDITOR.ENTER_BR,
									language : '<?php echo $language; ?>'
								});

						</script>
                    
                    </div>
                    
                    <div class="formPiece" style="width: 97%">

                        <input type="submit" value="<?php echo $lang['post']; ?>" />
                    
                    </div>
    
				</form>
	
			</div>
		</div>
	<div id="grand_bottom"></div>
</div>   
</div>

<div id="grand_container id_shielding" style="display: none;left: 10px; top:100px; position:fixed; width: 100%; height: 100%;">
    <div style="width: 805px; margin: auto;">
		<div id="grand_top" onMouseDown="dragStart(event, 'grand_container id_shielding')">
			<a onClick="sluitDiv('grand_container id_shielding')"><div id="grand_kruisje"></div></a>
		</div>

		<div id="grand_middle" style="height: 340px;">
        
        	<div style="max-height:500px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">

				<style type="text/css">
				h1 {
					padding-right: 24px;
					border-bottom: 1px solid #eeeeee;
					color: #53637d;
					font-size: 18px;
					font-weight: normal;
					margin: 0;
					padding-bottom: 5px;
					text-shadow: white 0 1px 2px;
					margin-bottom: 20px;
				}
				</style>

				<h1><?php echo $lang['shield_topic']; ?></h1>
                
                <?php 
				$qthread = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread'])."");
				$thread = mysql_fetch_array($qthread);
				?>

    			<form method="post" action="actions/mod_tool_thread_shielding.php">
                
                	<input type="hidden" name="id" value="<?php echo $core->EscapeString($_GET['thread']); ?>" />
                    <input type="hidden" name="forum" value="<?php echo $core->EscapeString($_GET['id']); ?>" />
                
                	<div class="formPiece" style="width: 97%">
                    
                    	<label><?php echo $lang['shielding']; ?></label>
                        <select name="shielding"> 
                        	<option <?php if($thread['shielding'] == 'yes'){ echo'selected="selected"';}?> value="yes"><?php echo $lang['profile_settings_yes']; ?></option>
                            <option <?php if($thread['shielding'] == 'no'){ echo'selected="selected"';}?> value="no"><?php echo $lang['profile_settings_no']; ?></option>
                        </select>
                    
                    </div>
                    
                    <div class="formPiece" style="width: 97%">

                        <input type="submit" value="<?php echo $lang['post']; ?>" />
                    
                    </div>
    
				</form>
	
			</div>
		</div>
	<div id="grand_bottom"></div>
</div>   
</div>

<div id="grand_container id_close" style="display: none;left: 10px; top:100px; position:fixed; width: 100%; height: 100%;">
    <div style="width: 805px; margin: auto;">
		<div id="grand_top" onMouseDown="dragStart(event, 'grand_container id_close')">
			<a onClick="sluitDiv('grand_container id_close')"><div id="grand_kruisje"></div></a>
		</div>

		<div id="grand_middle" style="height: 340px;">
        
        	<div style="max-height:500px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">

				<style type="text/css">
				h1 {
					padding-right: 24px;
					border-bottom: 1px solid #eeeeee;
					color: #53637d;
					font-size: 18px;
					font-weight: normal;
					margin: 0;
					padding-bottom: 5px;
					text-shadow: white 0 1px 2px;
					margin-bottom: 20px;
				}
				</style>

				<h1><?php echo $lang['close_topic']; ?></h1>

    			<?php 
				$qthread = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread'])."");
				$thread = mysql_fetch_array($qthread);
				?>

    			<form method="post" action="actions/mod_tool_thread_close.php">
                
                	<input type="hidden" name="id" value="<?php echo $core->EscapeString($_GET['thread']); ?>" />
                    <input type="hidden" name="forum" value="<?php echo $core->EscapeString($_GET['id']); ?>" />
                
                	<div class="formPiece" style="width: 97%">
                    
                    	<label><?php echo $lang['close']; ?></label>
                        <select name="close"> 
                        	<option <?php if($thread['closed'] == 'yes'){ echo'selected="selected"';}?> value="yes"><?php echo $lang['profile_settings_yes']; ?></option>
                            <option <?php if($thread['closed'] == 'no'){ echo'selected="selected"';}?> value="no"><?php echo $lang['profile_settings_no']; ?></option>
                        </select>
                    
                    </div>
                    
                    <div class="formPiece" style="width: 97%">

                        <input type="submit" value="<?php echo $lang['post']; ?>" />
                    
                    </div>
    
				</form>
	
			</div>
		</div>
	<div id="grand_bottom"></div>
</div>   
</div>

<div id="grand_container id_delete" style="display: none;left: 10px; top:100px; position:fixed; width: 100%; height: 100%;">
    <div style="width: 805px; margin: auto;">
		<div id="grand_top" onMouseDown="dragStart(event, 'grand_container id_delete')">
			<a onClick="sluitDiv('grand_container id_delete')"><div id="grand_kruisje"></div></a>
		</div>

		<div id="grand_middle" style="height: 340px;">
        
        	<div style="max-height:500px;overflow:scroll;overflow-y:scroll;overflow-x:hidden;">

				<style type="text/css">
				h1 {
					padding-right: 24px;
					border-bottom: 1px solid #eeeeee;
					color: #53637d;
					font-size: 18px;
					font-weight: normal;
					margin: 0;
					padding-bottom: 5px;
					text-shadow: white 0 1px 2px;
					margin-bottom: 20px;
				}
				</style>

				<h1><?php echo $lang['delete_topic']; ?></h1>
                
                <?php 
				$qthread = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread'])."");
				$thread = mysql_fetch_array($qthread);
				?>

    			<a href="actions/mod_tool_delete_thread.php?id=<?php echo $core->EscapeString($_GET['thread']); ?>&forum=<?php echo $core->EscapeString($_GET['id']); ?>">
                	
                    <label><?php echo $lang['delete_thread_question']; ?></label>
                	<input type="submit" value="<?php echo $lang['delete_thread']; ?>" />
                
                </a>
	
			</div>
		</div>
	<div id="grand_bottom"></div>
</div>   
</div>
<?php } ?>